handle NULL shaped object from the empty-child-anchor case by drawing a
authorHavoc Pennington <hp@redhat.com>
Thu, 30 Aug 2001 19:09:09 +0000 (19:09 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Thu, 30 Aug 2001 19:09:09 +0000 (19:09 +0000)
2001-08-30  Havoc Pennington  <hp@redhat.com>

* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
object from the empty-child-anchor case by drawing a little box.

* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
if the child anchor has no anchored widgets - fixes #59328.

Also, remove bizarre deletion of preedit string that seems to have
gotten in here somehow.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktextdisplay.c
gtk/gtktextlayout.c

index e163aab2eba8d0ddf973864e573cdf85abd42b4e..21e375642809a8663e170486f6e60e21dbd7596b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-08-30  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
+       object from the empty-child-anchor case by drawing a little box.
+       
+       * gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
+       if the child anchor has no anchored widgets - fixes #59328.
+
+       Also, remove bizarre deletion of preedit string that seems to have
+       gotten in here somehow.
+
 2001-08-30  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix
index e163aab2eba8d0ddf973864e573cdf85abd42b4e..21e375642809a8663e170486f6e60e21dbd7596b 100644 (file)
@@ -1,3 +1,14 @@
+2001-08-30  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
+       object from the empty-child-anchor case by drawing a little box.
+       
+       * gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
+       if the child anchor has no anchored widgets - fixes #59328.
+
+       Also, remove bizarre deletion of preedit string that seems to have
+       gotten in here somehow.
+
 2001-08-30  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix
index e163aab2eba8d0ddf973864e573cdf85abd42b4e..21e375642809a8663e170486f6e60e21dbd7596b 100644 (file)
@@ -1,3 +1,14 @@
+2001-08-30  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
+       object from the empty-child-anchor case by drawing a little box.
+       
+       * gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
+       if the child anchor has no anchored widgets - fixes #59328.
+
+       Also, remove bizarre deletion of preedit string that seems to have
+       gotten in here somehow.
+
 2001-08-30  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix
index e163aab2eba8d0ddf973864e573cdf85abd42b4e..21e375642809a8663e170486f6e60e21dbd7596b 100644 (file)
@@ -1,3 +1,14 @@
+2001-08-30  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
+       object from the empty-child-anchor case by drawing a little box.
+       
+       * gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
+       if the child anchor has no anchored widgets - fixes #59328.
+
+       Also, remove bizarre deletion of preedit string that seems to have
+       gotten in here somehow.
+
 2001-08-30  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix
index e163aab2eba8d0ddf973864e573cdf85abd42b4e..21e375642809a8663e170486f6e60e21dbd7596b 100644 (file)
@@ -1,3 +1,14 @@
+2001-08-30  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
+       object from the empty-child-anchor case by drawing a little box.
+       
+       * gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
+       if the child anchor has no anchored widgets - fixes #59328.
+
+       Also, remove bizarre deletion of preedit string that seems to have
+       gotten in here somehow.
+
 2001-08-30  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix
index e163aab2eba8d0ddf973864e573cdf85abd42b4e..21e375642809a8663e170486f6e60e21dbd7596b 100644 (file)
@@ -1,3 +1,14 @@
+2001-08-30  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
+       object from the empty-child-anchor case by drawing a little box.
+       
+       * gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
+       if the child anchor has no anchored widgets - fixes #59328.
+
+       Also, remove bizarre deletion of preedit string that seems to have
+       gotten in here somehow.
+
 2001-08-30  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix
index e163aab2eba8d0ddf973864e573cdf85abd42b4e..21e375642809a8663e170486f6e60e21dbd7596b 100644 (file)
@@ -1,3 +1,14 @@
+2001-08-30  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
+       object from the empty-child-anchor case by drawing a little box.
+       
+       * gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
+       if the child anchor has no anchored widgets - fixes #59328.
+
+       Also, remove bizarre deletion of preedit string that seems to have
+       gotten in here somehow.
+
 2001-08-30  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix
index 9149886c49a02a52c78fd67dfbc811f468cca061..d5b5f5018590c6dafca5dd885001c236674d573b 100644 (file)
@@ -297,8 +297,38 @@ render_layout_line (GdkDrawable        *drawable,
           GObject *shaped = (*shaped_pointer)->data;
 
           *shaped_pointer = (*shaped_pointer)->next;
-          
-          if (GDK_IS_PIXBUF (shaped))
+
+          if (shaped == NULL)
+            {
+              /* This happens if we have an empty widget anchor. Draw
+               * something empty-looking.
+               */
+              GdkRectangle shape_rect, draw_rect;
+
+              shape_rect.x = x + x_off / PANGO_SCALE;
+              shape_rect.y = risen_y - PANGO_PIXELS (logical_rect.height);
+              shape_rect.width = PANGO_PIXELS (logical_rect.width);
+              shape_rect.height = PANGO_PIXELS (logical_rect.height);
+
+              if (gdk_rectangle_intersect (&shape_rect, &render_state->clip_rect,
+                                           &draw_rect))
+                {
+                  gdk_draw_rectangle (drawable, render_state->fg_gc,
+                                      FALSE, shape_rect.x, shape_rect.y,
+                                      shape_rect.width, shape_rect.height);
+
+                  gdk_draw_line (drawable, render_state->fg_gc,
+                                 shape_rect.x, shape_rect.y,
+                                 shape_rect.x + shape_rect.width,
+                                 shape_rect.y + shape_rect.height);
+
+                  gdk_draw_line (drawable, render_state->fg_gc,
+                                 shape_rect.x + shape_rect.width, shape_rect.y,
+                                 shape_rect.x,
+                                 shape_rect.y + shape_rect.height);
+                }
+            }
+          else if (GDK_IS_PIXBUF (shaped))
             {
               gint width, height;
               GdkRectangle pixbuf_rect, draw_rect;
index 26bd73e256b9b03c5039176c445061ef49ec9ac3..c1aba56b1401f8f7db04550792d436b90d60f8bd 100644 (file)
@@ -1411,23 +1411,19 @@ add_child_attrs (GtkTextLayout      *layout,
 
   if (tmp_list == NULL)
     {
-      /* No widget at this anchor in this display;
-       * not an error.
+      /* If tmp_list == NULL then there is no widget at this anchor in
+       * this display; not an error. We make up an arbitrary size
+       * to use, just so the programmer can see the blank spot.
+       * We also put a NULL in the shaped objects list, to keep
+       * the correspondence between the list and the shaped chars in
+       * the layout. A bad hack, yes.
        */
 
-      return;
-    }
-
-  if (layout->preedit_string)
-    {
-      g_free (layout->preedit_string);
-      layout->preedit_string = NULL;
-    }
+      width = 30;
+      height = 20;
 
-  if (layout->preedit_attrs)
-    {
-      pango_attr_list_unref (layout->preedit_attrs);
-      layout->preedit_attrs = NULL;
+      display->shaped_objects =
+        g_slist_append (display->shaped_objects, NULL);
     }
   
   logical_rect.x = 0;
@@ -1540,7 +1536,10 @@ allocate_child_widgets (GtkTextLayout      *text_layout,
           GObject *shaped_object = shaped->data;
           shaped = shaped->next;
 
-          if (GTK_IS_WIDGET (shaped_object))
+          /* shaped_object is NULL for child anchors with no
+           * widgets stored at them
+           */
+          if (shaped_object && GTK_IS_WIDGET (shaped_object))
             {
               PangoRectangle extents;